package BookManagement.service;

import BookManagement.dao.CommentDao;
import BookManagement.domain.Comment;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.HashMap;
import java.util.List;

@Service("commentService")
public class CommentServiceImpl implements CommentService {

    @Autowired
    private CommentDao commentDao;

    @Override
    public int addComment(Comment comment) {
        return commentDao.addComment(comment);
    }

    @Override
    public List<Comment> findCommentsByBook(HashMap<String,Object> map) {
        return commentDao.findCommentsByBook(map);
    }

    @Override
    public List<Comment> findCommentsByUser(HashMap<String,Object> map) {
        return commentDao.findCommentsByUser(map);
    }

    @Override
    public int deleteComment(HashMap<String, Object> map) {
        return commentDao.deleteComment(map);
    }

    @Override
    public int findCommentCountForBook(String bookISBN) {
        return commentDao.findCommentCountForBook(bookISBN);
    }

    @Override
    public int findCommentCountForUser(String userName) {
        return commentDao.findCommentCountForUser(userName);
    }

    @Override
    public Comment findOnlyComment(HashMap<String, Object> map) {
        return commentDao.findOnlyComment(map);
    }
}
